MODE

Syntax: MODE mode%
    or: MODE screen_mode [,display_type]
           (Minerva, Q-Emulator, Amiga-QDOS v3.23+)
    or: MODE [screen_mode [,display_type]]    (PEX)
Location: QL ROM, PEX

The original QDOS operating system will only recognise two display modes: Low resolution and High resolution. 

However, the following MODEs are currently set aside for use by QDOS compatible systems:

MODE Resolution    Colours   System
2    640 x 400     2         SMS-2
4    <=1000 x 400  4         SMS-2
4    768 x 280     4         ST/QL, Ext. MODE 4
4    <=1024 x 1024 4         QVME
4    <=800 x 600   4         QXL, QXL II, QPC
4    512 x 256     4         QDOS and others
8    256 x 256     8         QDOS and others
8    256 X 256     4         ST/QLs
12   256 x 256    16         THOR XVI

The MODE command is used to select the mode and redraw all windows. Without Qjump's Window Manager WMAN, the screen mode is set globally, whereas if WMAN (or SMSQ/E) is installed, MODE will only affect the current job.

The parameter mode% should be one of the above four values. Normally if a system does not support the mode type selected, MODE 4 is selected.

The MODE command also resets the current status of UNDER, FLASH, CSIZE and OVER.

The second variant is supported on Minerva, Q-Emulator (for the MacIntosh), PEX and the Amiga QDOS Emulator (v3.23+) and allows you to dictate the type of display used.  The display_type can be one of four values (the default is -1):

display_type effect
0            Set to monitor mode
1            Set to TV (625 lines) mode (European)
2            Set to TV (525 lines) mode (American)
-1           Leave display type as it is

On the PEX variant, if you do not specify any parameters, MODE will default to MODE 4,0

DUAL SCREEN MODE:
Minerva and some other implementations allow you to have two screens which can both be accessed by the user (and can be switched between by pressing <CTRL><TAB>). Each of these two screens (if you are in dual screen mode), can support a different mode. In order to cater for these new features, screen_mode is very complex, and to make it worse, it is important to know which screen is the default screen (see DEFAULT_SCR).

Programs which use the normal MODE commands will still work under dual screen mode, since the new version of the MODE command will only work if the display_type is specified.

In the dual screen mode, after starting up the QL, the default screen is scr0 (located at $20000 - the normal QL display screen). The second screen (scr1) is located at $28000 and is known as the Other Screen. 

To make matters worse, each job present in the QL's memory will be allocated its own default screen, being the current default when it was started. A job can therefore alter its own current default screen without upsetting the rest of the system.

Before proceeding any further it is important to realise that the Displayed Screen (what you can see on your TV/monitor) and the Default Screen are not necessarily one and the same thing. 

Oh, it is also important to know that a screen can also be either visible or blank (this is so that work can be prepared on a screen without the user being able to see the process). Perhaps some definitions might help:

Displayed Screen:
--- this is the screen which is currently in
    front of the user on his/her monitor or
    TV.

Default Screen:
--- the screen on which a program's windows
    will be opened and upon which the normal
    MODE 4 and MODE 8 commands will have an
    effect.

Other Screen:
--- the opposite to the Default Screen

Visible Screen:
--- this means that the specified screen
    can actually be seen by the user.

Blank Screen:
--- the specified screen is invisible to the
    user

OPEN#3,scr_448x200a32x16 

will open a new window on the current Default Screen. After this, any subsequent commands using #3 will be shown on that screen (whether or not it is still the current Default Screen).

Another plus to the altered MODE command is that there is no forced re-draw of all the current windows unless you specify that this must be carried out (or if you use the original MODE variants).

In order to try and explain the new display_mode parameters, it is easier to split it into two sections: toggling current values and setting absolute values. 

TOGGLING THE SCREEN PARAMETERS
This uses the format MODE 64+n,-1, where:

n  Effect:                 From:   To:
1  Toggle Other Screen     visible blank
2  Toggle Default Screen   visible blank
4  Toggle Other Screen     Mode 4  Mode 8
8  Toggle Default Screen   Mode 4  Mode 8
16 Toggle Displayed Screen scr0    scr1
32 Toggle Default Screen   scr0    scr1

Adding together different values of n will combine these effects (although if one of the values is to be 32, the default screen will be toggled before anything else is carried out).

Example:
MODE 64+16,-1: PAUSE: MODE 64+16,-1   
Show both screens.       

SETTING ABSOLUTE SCREEN PARAMETERS
This uses the format   
MODE -128 + m - 256 * t + c, -1

where:   
m = k1*n1 + k2*n2 + k3*n3 +...    
t = n1 + n2 + n3 +...n
c = (see below)

 n               can have the same values as
                 above.

k1, k2, k3...    have the following effect
                 upon the corresponding values
                 of n1, n2, n3, etc.:

k   Sets n to:      
0   the 'from..' column above      
1   the 'to..' column above    

c   Effect   
0               Do not redraw any screens
-16384          Re-draw the Other Screen
32768           Re-draw the Default Screen
16384           Re-draw both screens

Again, different effects can now be combined with relevant values for each n and k.  If you wish to toggle any effects at the same time, simply add the corresponding value of n to the first parameter.

Dual Screen Examples:       
MODE-17791,-1
blank out Other Screen and then force it into 4-colour mode, redrawing all windows:
t = 1 + 4
m = 1*1 + 0*4
c = -16384
-17791 = -128 + m - 256*t + c


CROSS-REFERENCE: 
RMODE can be used to read the current screen mode (and even whether the second screen is available) and DEFAULT_SCR will tell you which is the current default screen.  
SCREEN(#3) will tell you the address of the start of the screen on which window #3 is situated. 
DISP_SIZE can be used to set the size of the displayed screen on extended resolutions.
